package com.wiim.connector;

import java.util.ArrayList;
import java.util.List;

import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;

public class RestTemplateFactory {
	private static StateRestTemplate httpRestTemplate = null;

	public static StateRestTemplate getHttpRestTemplate() {
		if (httpRestTemplate == null) {
			GsonHttpMessageConverter messageConverter = new GsonHttpMessageConverter();
			List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
			messageConverters.add(messageConverter);

			httpRestTemplate = new StateRestTemplate();
			httpRestTemplate.setMessageConverters(messageConverters);
		}
		return httpRestTemplate;
	}
}
